1. Field of the Invention
The present invention relates to picture synchronization circuit and method for a moving picture decoder, and more particularly, to picture synchronization circuit and method wherein decoding is delayed or a current picture is skipped without decoding by comparing a decoding time stamp value of a picture with a count value of a system time clock at the moment of picture input, thereby restoring the decoding time of the picture. The present invention is based on Korean Application No. 96-38453, which is incorporated herein by reference.
2. Description of the Prior Art
Digital video technology is applicable not only to communication fields such as video teleconference and video telephone, but also to various applied fields such as the computer and home appliance products. For the purpose of technical cooperation between different applied fields, the Internal Organization for Standardization (ISO) has started developing a standard of videos for digital storage media and associated audio. Such an effort for standardization has brought about the motion picture experts group (MPEG).
MPEG standardization relates to a picture, sound and a system. The picture denotes coding of moving picture information, the sound denotes coding of sound information, and the system denotes coding of multi-information where sound is combined with a picture. Accordingly, the picture, the sound and the system are called MPEG-video, MPEG-audio and MPEG-system, respectively. As for coding of the moving picture information, an MPEG-2 picture decoder for decoding coded moving picture data is shown in FIG. 1.
Referring to FIG. 1, a buffer 10 temporarily stores received coded data. A demultiplexer & variable-length decoder (hereinafter, called "a variable-length decoder") 12 variable-length decodes coded data output by the buffer 10, and outputs the variable-length decoded data and quantized stepsize (QP) to an inverse-quantizer 14, outputs a macroblock-type control signal (MB type) and a motion vector (MV) to an adaptive predictor 22, and outputs a DCT mode control signal (DCT mode) to an IDCT (inverse discrete cosine transform) processor 16. Additionally, types of pictures input to the encoder are I, P and B.
The received coded data is a moving picture signal which has an MPEG-2 structure and is interframe-coded between pictures. Here, according to the interframe coding, other pictures, except for intrapictures within a 1 GOP unit, are coded with only the difference between adjacent pictures. The 1 GOP has intrapicture (I) data, capable of being independently coded without other picture data; predicted picture (P) data, which is obtained from preceding intrapicture data or predicted picture data and can be coded using compensation of the motion between adjacent pictures; and interactive predicted picture (B) data, which is obtained from the preceding intrapicture data or predicted picture data and from the following intrapicture data or predicted picture data, and can be coded by the motion compensation.
The inverse-quantizer 14 inverse-quantizes the variable-length decoded data, using the quantization stepsize (QP) used during decoding. The IDCT processor 16 inverse-DCT processes the inverse-quantized data according to a DCT mode control signal (DCT mode), and outputs the result to the first input of an adder 18. That is, the IDCT processor 16 performs inverse-DCT conversion with respect to the original picture in the case of an I-picture, and performs inverse-DCT conversion with respect to the difference component in the case of a P- or B-picture.
The output of the adder 18 is stored in a field/frame memory 20 and then output. The MPEG-2 moving picture decoder can support both field mode and frame mode as a screen processing mode, and requires the field/frame memory 20 to use the field mode when pictures contain much motion and to use the frame mode when pictures contain little motion.
Meanwhile, the adaptive predictor 22 predicts data, using data stored in the field/frame memory 20, according to the macroblock type control signal (MB type) and the motion vector which are output by the variable-length decoder 12, and outputs the result to the second input of the adder 18.
Here, the macroblock type usually uses a 4:2:0 format. Since a picture has a structure in which a field coexists with a frame, the MV obtained from each field is independently applied depending on each field, in a field structure, and is applied regardless of fields, in a frame structure.
The adaptive predictor 22 is employed when the received picture is a P- or B-picture. That is, the adaptive predictor 22 outputs a motion compensation prediction signal to the adder 18 on the basis of the previous I- and P-pictures, in the case of the P-picture, and generates a motion compensation prediction signal and a motion compensation interpolated signal on the basis of the previous and next I- and P-pictures, in the case of the B-picture. At this time, the best signal of the generated prediction signals is selected and applied to the adder 18.
Thus, the adder 18 outputs data output by the IDCT processor 16 to the field/frame memory 20 in the case of the I-picture, and adds the output of the IDCT processor 16 to the output of the adaptive predictor 22 and outputs the result to the field/frame memory 20 in the case of a P- or B-picture.
Meanwhile, coded moving picture data includes a program clock reference (hereinafter, called "PCR") for synchronization of the encoder with the corresponding decoder, a presentation time stamp (PTS) and a decoding time stamp (DTS).
Here, the PCR has 42 bits, and is used as the reference for a phase locked loop (PLL) circuit for restoring a 27 MHz system time clock (STC) of the encoder. Also, the PCR is made up of PCR.sub.-- base 33 bits and PCR.sub.-- ext 9 bits. Here, the PCR base represents time in 90KHz units, being 1/300 of 27 MHz, and is expressed as follows: EQU PCR=PCR.sub.-- base.times.300+PCR.sub.-- ext (1).
The PTS is made up of 33 bits, and represents time in 90 KHz units, representing the start of picture display. The DTS is made up of 33 bits, and represents time in 90 KHz units, representing the start of picture encoding.
The PTS and DTS are not present in every picture. That is, there are cases when both of the PTS and DTS do not exist in each picture, or when only the PTS exists. For example, there is a case when the PTS and DTS are identical, as in the B-picture. Accordingly, when a picture does not have both of the PTS and DTS, the encoder makes the DTS of the current picture from the DTS of the previous picture. For example, when the frame rate is 60 Hz, "1500" is added to the DTS of the previous picture, and the resultant sum is set as the DTS of the current picture. Also, when a picture has only the PTS, the PTS is used as the DTS.
Meanwhile, if the DTS of a picture is larger than the count value of a system time clock at the moment of starting picture decoding on the basis of an up-counted value by a 90 KHz clock obtained by dividing 27 MHz STC by 300, the picture will be decoded earlier than expected. On the other hand, if the DTS of a picture is smaller than the count value of the system time clock, the picture will be decoded later than expected.
Therefore, when the picture is decoded earlier than expected, the buffer 10 of FIG. 1 underflows, and when the picture is decoded later than expected, the buffer 10 overflows. Thus, a normal decoding process is not carried out.